package com.lianqi.emcpframework.ddd.gencode.define;

import java.util.Collection;
import java.util.Map;

import com.google.common.collect.Maps;

/**
 * @program
 * @ClassName JavaSourceCollector
 * @description: 类包装控制器
 * @author: sky
 * @create: 2019-06-13 15:36
 */
public final class JavaSourceCollector {
    /**
     * 类名称和类包装对应关系
     */
    private final Map<String, JavaSource> javaSources = Maps.newHashMap();

    public Collection<JavaSource> getAllJavaSource() {
        return this.javaSources.values();
    }

    public JavaSource getByName(String name) {
        return javaSources.get(name);
    }

    public void register(String name, JavaSource javaSource) {
        this.javaSources.put(name, javaSource);
    }

    public void register(JavaSource javaSource) {
        register(javaSource.getFullName(), javaSource);
    }
}
